home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Mag HDD Backup
/
Amiga Mag HDD Backup.zip
/
Amiga Mag HDD Backup
/
Alexander.img.bin
/
Alexander.img
/
tech 4.1 editorial Archive.sit
/
Iovine
/
Cell_Auto
(
.txt
)
< prev
next >
Wrap
AmigaBASIC Source Code
|
1993-06-18
|
912b
|
28 lines
REM Cellular Automatiom by John Iovine
SCREEN 1,320,200,4,1
WINDOW 2,"Artificial Life --- Cellular Automa",,23,1
RANDOMIZE TIMER :PALETTE 0,0,0,0
DIM ol(325),ne(325),ko(325),code(16)
FOR x = 1 TO 16: READ n:code(x) = n:PALETTE x,RND,RND,RND:NEXT
DATA 0,1,0,1,1,0,1,0,1,1,1,0,0,1,1,0 :
GOSUB seed
display:
FOR y = 1 TO 319
rule = (4* ol(y-1) + 4 * ol(y) + 3 * ol(y+1) + 2* ol(y+2) + 2 * ol(y+3)) + 1
ne(y) = code(rule): ko(y) = rule:NEXT
FOR y = 1 TO 319
IF ne(y) = 1 THEN PSET(y,ht),(ko(y)-1) :ELSE PSET(y,ht),0
ol(y) = ne(y): NEXT
ht = ht + 1
IF ht = 184 THEN ht = 170: GOSUB change:LOCATE 23,1:PRINT:PRINT
getkey:
a$ = INKEY$
IF a$="q" THEN SCREEN CLOSE 1: END
IF a$ <> "" THEN GOSUB change
GOTO display
change:
cg = INT(RND(1)*16) + 1: dc = INT(RND(2) * 2):code(cg) = dc:RETURN
seed:
FOR i = 0 TO 325:ol(i) = INT(RND(2) * 2):NEXT:RETURN